<?php

/**
 * Hardware form base class.
 *
 * @method Hardware getObject() Returns the current form's model object
 *
 * @package    testyZlecenia
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseHardwareForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                     => new sfWidgetFormInputHidden(),
      'komponenty_komponent'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Komponenty_2'), 'add_empty' => false)),
      'model'                  => new sfWidgetFormInputText(),
      'komponenty_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Komponenty'), 'add_empty' => false)),
      'zlecenia_zgloszenia_id' => new sfWidgetFormInputHidden(),
    ));

    $this->setValidators(array(
      'id'                     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'komponenty_komponent'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Komponenty_2'))),
      'model'                  => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'komponenty_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Komponenty'))),
      'zlecenia_zgloszenia_id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('zlecenia_zgloszenia_id')), 'empty_value' => $this->getObject()->get('zlecenia_zgloszenia_id'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('hardware[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Hardware';
  }

}
